﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;

namespace SudokuWPF.UserControls
{
    /// <summary>
    /// Stopwatch.xaml 的交互逻辑
    /// </summary>
    public partial class Stopwatch : ToggleButton   //Stopwatch控件派生至Toggle按钮
    {
        public Stopwatch()
        {
            InitializeComponent();
        }

        //静态成员属性描述当前时间对象
        public static readonly DependencyProperty CurrentTimeProperty = DependencyProperty.Register
            ("CurrentTime",
            typeof(double),
            typeof(Stopwatch),
            new FrameworkPropertyMetadata(0.0,FrameworkPropertyMetadataOptions.AffectsRender)
            );//注册依赖项属性.属性名称为CurrentTime,属性类型为typeof(double)，所有者类型是typeof(Stopwatch)

        //CurrentTime 属性，用于获取和设置当前时间属性
        public double CurrentTime
        {
            get
            {
                return (double)this.GetValue(CurrentTimeProperty);
            }
            set
            {
                this.SetValue(CurrentTimeProperty, value);
            }
        }
    }

}
